/* Tiptap DOCX 编辑器样式 */

/* 编辑器容器 */
.tiptap-docx-editor {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  background: white;
  overflow: hidden;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: box-shadow 0.3s ease;
}

.tiptap-docx-editor:hover {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

/* 工具栏 */
.tiptap-toolbar {
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  border-radius: 0.75rem 0.75rem 0 0;
  max-height: 6.5rem; /* 限制为刚好两行 */
  overflow-y: auto; /* 如果超出则允许滚动 */
}

.tiptap-toolbar-button {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #374151;
}

.tiptap-toolbar-button:hover:not(:disabled) {
  background: #e5e7eb;
}

.tiptap-toolbar-button.active {
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.tiptap-toolbar-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tiptap-toolbar-divider {
  width: 1px;
  height: 1.5rem;
  background: #d1d5db;
  margin: 0 0.25rem;
}

.tiptap-toolbar-select {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  background: white;
  cursor: pointer;
}

.tiptap-toolbar-select:hover {
  background: #f9fafb;
}

.tiptap-toolbar-select:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 0;
}

/* 编辑区域容器 */
.tiptap-editor-content {
  flex: 1;
  overflow-y: auto;
}

/* ProseMirror 编辑器样式 */
.ProseMirror {
  padding: 1.5rem;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: #1f2937;
  height: 100%;
  min-height: 320px;
  outline: none;
}

/* 占位符 - 当编辑器为空时显示 */
.ProseMirror:empty::before {
  content: attr(data-placeholder);
  float: left;
  color: #9ca3af;
  pointer-events: none;
  height: 0;
  font-style: italic;
}

.ProseMirror > p:first-child:last-child:only-child:empty::before {
  content: attr(data-placeholder);
  float: left;
  color: #9ca3af;
  pointer-events: none;
  height: 0;
  font-style: italic;
}

/* 标题样式 */
.ProseMirror h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  color: #111827;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0.5rem;
}

.ProseMirror h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  color: #111827;
}

.ProseMirror h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  color: #111827;
}

/* 段落 */
.ProseMirror p {
  margin-bottom: 1rem;
  line-height: 1.75;
}

/* 列表 */
.ProseMirror ul,
.ProseMirror ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.ProseMirror ul {
  list-style-type: disc;
}

.ProseMirror ol {
  list-style-type: decimal;
}

.ProseMirror li {
  margin-bottom: 0.25rem;
  line-height: 1.75;
}

.ProseMirror li p {
  margin-bottom: 0.25rem;
}

/* 粗体 */
.ProseMirror strong {
  font-weight: 700;
  color: #111827;
}

/* 选中节点 */
.ProseMirror-selectednode {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* 加载状态 */
.tiptap-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #6b7280;
}

/* 响应式 */
@media (max-width: 640px) {
  .tiptap-toolbar {
    padding: 0.5rem;
    max-height: 6rem; /* 小屏幕允许稍微高一点 */
  }
  
  .tiptap-toolbar-button {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .ProseMirror {
    padding: 1rem;
    font-size: 14px;
  }
}

